<template>
  <div class="inspectionDetails">
    <div class="inspectionDetails-boxn">
      <lookUpText class="inspectionDetails-boxn-Upte" title="基本信息" />

      <a-descriptions :data="basics" bordered />
    </div>
    <div v-for="(value, index) in IMAGEKIND()" :key="index" class="inspectionDetails-boxn">
      <lookUpText class="inspectionDetails-boxn-Upte" :title="value.label">
        <template #right>
          <a-button size="mini" type="primary" @click="onUpDate(value.label, value.value)">点击添加上传{{ value.label }}信息</a-button>
        </template>
      </lookUpText>
      <div class="inspectionDetails-boxn-lookUn">
        <a-empty v-if="isNullPm(ossList[value.value])" />
        <a-image-preview-group v-if="!isNullPm(ossList[value.value])" infinite>
          <a-space wrap>
            <template v-for="(value, index) in ossList[value.value]" :key="index">
              <a-image
                v-if="translation(value.url)"
                style="margin-right: 10px; vertical-align: top"
                :title="value.name"
                :description="IMAGEKIND(value.type).label"
                :src="value.url"
                width="200"
                height="120"
              />
              <img v-else style="width: 64px" src="@img/itemDetails/pdf.png" @click="goToRouter(value.url)" />
            </template> </a-space
        ></a-image-preview-group>
      </div>

      <!-- <uploadFile /> -->
    </div>

    <a-modal v-model:visible="visible" :on-before-ok="handleOk" @cancel="handleCancel">
      <template #title> {{ title }} </template>
      <div>
        <!-- <a-form :model="form" auto-label-width>
          <a-form-item label="文件类型">
            <a-select :style="{ width: '220px' }" v-model="typeValue" placeholder="请选择文件类型">
              <a-option v-for="(value, index) in IMAGEKIND()" :key="index" @click="selectDoom(value)" :value="value.value">{{
                value.label
              }}</a-option>
            </a-select>
          </a-form-item>
        </a-form> -->
        <div class="inspectionDetails-viewtext">文件预览</div>
        <uploadFile v-if="visible" :img-list="imgListPla()" @filelist="uploadPM" />
      </div>
    </a-modal>
  </div>
</template>

<script lang="ts">
import lookUpText from '@com/lookUpText/lookUpText.vue';
import uploadFile from '@com/uploadFile/uploadFile.vue';
import importConfig from './itemDetails';
import { toRefs } from 'vue';
import { isNullPm } from '@/utils/baseMethods';
export default {
  components: {
    lookUpText,
    uploadFile,
  },
  setup() {
    const { base, init, onUpDate, IMAGEKIND, selectDoom, uploadPM, handleOk, translation, goToRouter, imgListPla } = importConfig();
    init();
    return {
      ...toRefs(base),
      init,
      onUpDate,
      IMAGEKIND,
      selectDoom,
      uploadPM,
      handleOk,
      isNullPm,
      translation,
      goToRouter,
      imgListPla,
    };
  },
};
</script>

<style lang="less" scoped>
.inspectionDetails {
  padding: 20px;
  background: white;
  &-boxn {
    margin-bottom: 20px;
    &-Upte {
      margin-bottom: 10px;
    }
    &-lookUn {
      width: calc(100% - 40px);
      padding: 20px;
      border: 1px solid #d6d6d6;
      border-radius: 5px;
    }
  }
  &-viewtext {
    margin-bottom: 10px;
  }
  :deep(.arco-image-footer) {
    background: #555555;
  }
}
</style>
